<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/templates/common/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>解放军第三0五医院</title>

<%@include file="/WEB-INF/templates/common/common.jsp"%>

<link rel="stylesheet" href="${basePath}/static/page/css/pagination.css" />
<link rel="stylesheet" href="${basePath}/static/page/css/reset.css" />

<script type="text/javascript" src="${basePath}/static/page/js/lib/jquery.min.js"></script>
<script type="text/javascript" src="${basePath}/static/page/js/jquery.pagination.js"></script>
<script  type="text/javascript" src="${basePath}/static/My97DatePicker/WdatePicker.js"></script>
</head>
<body>

</head>
<body>
 <!--头部-->
 <%@include file="/WEB-INF/templates/common/header.jsp"%>

<!------导航条-->
 <%@include file="/WEB-INF/templates/common/navigation.jsp"%>
<div id="list_main">
 <div id="list_DH">
   <!--打印模块导航栏-->
 <%@include file="/WEB-INF/templates/common/printnav.jsp"%>
 </div>
 <div id="list_NR">
  <div class="loc">
   <h3 style="font-size:14px">病案打印</h3>

  </div>
  ${hospitals}
  <div class="list_con_table"> 
   <div class="search_table" style="position:relative">
    <ul>
    <li class="Label_1">病案所属人姓名：&nbsp;</li>
    <li class="Label_2"><input class="input_box" type="text" maxlength="10" name='patientName' id='patientName' value='' /></li>
    <li class="Label_1">病案所属人身份证：</li>
    <li class="Label_2"><input class="input_box" type="text" maxlength="20" name='patientCard' id='patientCard' value='' /></li>
    <li class="Label_1">诊疗记录标示：&nbsp;</li>
    <li class="Label_2"><input class="input_box" type="text"  maxlength="10" name='applyName' id='applyName' value='' /></li>
    <li class="Label_1">申请时间：&nbsp;</li>
     <li class="Label_2" style="width:495px;text-align:left">
     <input style="width:175px;margin-left:5px" class="input_box" id="timeStart" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" type="text"  name=''  value='' /> - <input style="width:175px" class="input_box" id="timeEnd" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" type="text"  name=''  value='' />
     </li>
     <li class="Label_1">医疗机构：&nbsp;</li>
    <li class="Label_2">
    	<select>
    		<c:forEach items="${hospitals}" var ="hospital">
    			<option value="${hospital.id}">${hospital.name}</option>
    		</c:forEach>
    	</select>
    </li>
    </li>
     <li class="Label_1">出院科室：&nbsp;</li>
    <li class="Label_2">
    <select>
    	<c:forEach items="${hospitals}" var ="hospital">
    		<option value="${hospital.id}">${hospital.name}</option>
    	</c:forEach>
    
    </select></li>
    <li class="Label_5">
     <a  href="javascript:queryPrint()">查询</a>
    </li>
    </ul>
   </div>
  </div>
  <style>
  .table td{width:116px}
  </style>
 <table class="table" style="width:934px;float:left;margin-botton:10px border-collapse:collapse;" cellpadding="0" cellspacing="0">
     
      <tr>
      <td class="tdLabel_4">序号</td>
      <td class="tdLabel_4">姓名</td>
      <td class="tdLabel_4">申请人</td>
      <td class="tdLabel_4">身份证号</td>
      <td class="tdLabel_4">诊疗标示</td>
      <td class="tdLabel_4">申请时间</td>
      <td class="tdLabel_4">打印状态</td>
      <td class="tdLabel_4">打印份数</td>
      <td class="tdLabel_4">申请原因</td>
      <td class="tdLabel_4">操作</td>
      </tr>
      <tbody id="tbody">

      </tbody>
      
     </table>
     <!--  <div class="pageList" >style="position:absolute;top:5"
            <ul class="pagination clearfix" id="page_plus"></ul>
            <div class="pagination">
                <div>总共：<b id="totalPage">0</b> 条信息    当前页是第 <b id="currentPage">0/0</b>　页</div>
            </div>
        </div> -->
    <div class="pages">
        <div id="Pagination"></div>
        <div class="searchPage">
          <span class="page-sum">共<strong id="ston_page_msg" class="allPage">0</strong>页</span>
          <span class="page-go">跳转<input type="text" class="number">页</span>
          <a href="javascript:;" class="page-btn">GO</a>
        </div>
    </div>
     
      

 	
 </div>
</div>
<!--页脚部分-->
 <%@include file="/WEB-INF/templates/common/footer.jsp"%>
 <script>
 	//查询打印申请信息
 	function queryPrint(){
 		 var val=$('input:radio[name="printCheck"]:checked').val();
 		 var patientName=$("#patientName").val();
 		 var patientCard=$("#patientCard").val();
 		 var medicalRecord=$("#medicalRecord").val();
 		 var startTime=$("#timeStart").val();
 		 var endTime=$("#timeEnd").val();
 		 var applyName=$("#applyName").val();
 		 var applyCard=$("#applyCard").val();
 		$.ajax({
 			type:"post",
 			url:"${basePath}/print/getPrintList",
 			data:{patientName:patientName,patientCard:patientCard,startTime:startTime,endTime:endTime,status:val,
 				medicalRecord:medicalRecord,applyName:applyName,applyCard:applyCard},
 			success:function(data){
 				if(data!=null && data!=""){
 					var len=data.length;
 					var html="";
 					for(var i=0;i<len;i++){
 						var applyPrint=data[i];
 						html+="<tr>"+
 					     " <td class='tdLabel_5'>"+(i+1)+"</td>"+
 					     " <td class='tdLabel_5'>"+applyPrint.patientName+"</td>"+
 					    " <td class='tdLabel_5'>"+applyPrint.applyName+"</td>"+
 					     " <td class='tdLabel_5'>"+applyPrint.patientCard+"</td>"+
 					     " <td class='tdLabel_5' >"+applyPrint.medicalRecord+"</td>"+
 					     " <td class='tdLabel_5'>"+applyPrint.applyDate+"</td>"+
 					     " <td class='tdLabel_5' id='check"+applyPrint.applyPrintDetailId+"'>"+getPrintStatus(applyPrint.printStatus)+"</td>"+
 					    " <td class='tdLabel_5'>"+applyPrint.printCopies+"</td>"+
 					     " <td class='tdLabel_5'>"+getApplyReason(applyPrint.applyReason)+"</td>"+
 					     " <td class='tdLabel_5'><a id='TC1' onclick='print("+applyPrint.printStatus+","+applyPrint.printDetailId+")' >打印</a></td>"+
 					    "  </tr>";
 					    
 					}
 					$("#tbody").html(html);
 				}else{
 					$("#tbody").html("");
 					alert("数据为空!")
 				}
 			}
 		})
 	}
 	
 	/**
 	 * Created by Administrator on 2017/7/13.
 	 */
 	$(document).ready(function() {
 		
 		var totalCounts = 1000;
 		var pageSize = 20;
 		var totalPages = Math.ceil(totalCounts/pageSize);
 		var currentPage = 1;
 		$("#ston_page_msg").text(totalPages);
 		$(".number").keypress(function(event) {  
 			 var ev = event.which?event.which:window.event.keyCode;
 			  if(ev>=48&&ev<=57){
 				return true;  
 			  }else if(ev==8 || ev==13 || ev==46){
 				return true;  
 			  }else{
 				return false;
 			  } 
 		}).focus(function() {  
 			this.style.imeMode='disabled';  
 		});  
 		$("#Pagination").pagination(totalPages,{
 		current_page:currentPage,
 	  callback: function (page_index,jp) {
 		//alert(page_index);
 	  } //PageCallback() 为翻页调用次函数。
 	  
 	  });
 	});
 </script>
</body>
</html>
